package acm.浙江24赛;

import java.util.Scanner;

public class 上分好日志 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] chars = sc.nextLine().toCharArray();
        long ans = 0;
        for (int j = 0; j < chars.length; j++) {
            if (chars[j] == '1') {
                int i = j;
                while (j < chars.length && chars[j] == '1') {
                    j++;
                }
                int len = j - i;
                ans += f(len);
                j--;
            } else {
                ans -= 12;
            }
        }
        System.out.println(ans);
    }

    public static long f(int n) {
        long res = n * 3L;
        if (n <= 6) {
            res += (long) (n - 1) * (n) / 2;
        }
        if (n > 6) {
            res+=15;
            res += (n-6) * 5L;
        }
        return res;
    }
}
